<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://unpkg.com/vue/dist/vue.js"></script>
  <script src="https://unpkg.com/vue-router/dist/vue-router.js"></script>

  <style>
    .active {
      font-weight: 500;
      color: red;
    }
  </style>
</head>

<body>

  <div id="app">

    <ul>
      <router-link tag="li" to="/position/35/city/10" exact active-class="active">前端研发</router-link>
      <router-link tag="li" to="/position" exact active-class="active">职位</router-link>
      <router-link tag="li" to="/search" active-class="active">搜索</router-link>
    </ul>
    <router-view></router-view>
  </div>

  <script>
    const position = {
      template: `<div>postion</div>`
    }

    const search = {
      template: `<div>search</div>`
    }



    var router = new VueRouter({
      mode: 'hash',
      routes: [
        {
          path: '/position',
          component: position
        },
        {
          path: '/position/:id/city/:cid',
          component: {
            template: `
            <div>
            position detail {{$route.params}}
            </div>
            `
          }
        },
        {
          path: '/search',
          component: search
        },
        {
          path: '*',
          component: {
            template: `<h1>404 page not found !</h1>`
          }
        }
      ]
    })

    var vm = new Vue({
      router,
      el: '#app'
    })

  </script>

</body>

</html>